package com.thinkgem.jeesite.modules.magnetic.controller;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.modules.area_info.entity.AreaInfo;
import com.thinkgem.jeesite.modules.area_info.service.AreaInfoService;
import com.thinkgem.jeesite.modules.area_info_his.entity.AreaInfoHis;
import com.thinkgem.jeesite.modules.area_info_his.service.AreaInfoHisService;
import com.thinkgem.jeesite.modules.area_info_yesterday.entity.AreaInfoYesterday;
import com.thinkgem.jeesite.modules.area_info_yesterday.service.AreaInfoYesterdayService;
import com.thinkgem.jeesite.modules.lane.entity.Lane;
import com.thinkgem.jeesite.modules.magnetic.util.DataFlushUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author xlp
 * @date 2019/4/15
 */
@Controller
@RequestMapping(value = "${adminPath}/data/flush")
public class DataFlushController {

    @Autowired
    private AreaInfoYesterdayService yesterdayService;

    @Autowired
    private AreaInfoHisService hisService;

    @Autowired
    private AreaInfoService areaInfoService;

    @RequestMapping(value = {"yesterday", ""})
    public List<AreaInfoYesterday> list(HttpServletRequest request, HttpServletResponse response,
                                        Model model) {
        /*List<AreaInfo> areaInfos = areaInfoService.findList(new AreaInfo());
        for (AreaInfo areaInfo:areaInfos){
            System.out.println("进行区域"+areaInfo.getAreaName()+"分析");
            //按区域查询数据集合
            List<AreaInfoYesterday> list = yesterdayService.findDayList(areaInfo);
            if (!CollectionUtils.isEmpty(list)){
                DataFlushUtil.handelAreaCarUse(list, hisService);
            }
        }*/
        return new ArrayList<AreaInfoYesterday>();
    }
}
